﻿// Shader-Based-Image-Processing (SBIP)
// http://code.google.com/p/sbip/
//
// Copyright © Frank Nagl, 2009-2010
// admin@franknagl.de
//
namespace SBIP.OptionsForms
{
    using System;
    using System.Windows.Forms;
    using Filter;

    /// <summary>Filter specified properties form.</summary>
    public partial class GaussianBlurForm : Form
    {
        private readonly GaussianBlurLight filter;

        /// <summary>
        /// Initializes a new instance of the <see cref="SobelForm"/> class.
        /// </summary>
        /// <param name="processor">The processor.</param>
        public GaussianBlurForm(Processor processor)
        {
            InitializeComponent();
            if (processor.HighDef)
            {
                filter = new GaussianBlur();
                gbSize.Enabled = true;
            }
            else
            {
                filter = new GaussianBlurLight();
            }
            processor.Filter = filter;
        }

        private void TrbarSigmaValueChanged(object sender, EventArgs e)
        {
            float sigma = trbarSigma.Value / 1000.0f;
            filter.Sigma = sigma;
            lbSigma.Text = sigma.ToString();
        }

        private void TrbarSizeValueChanged(object sender, EventArgs e)
        {
            int size = 2 * trbarSize.Value + 1;
            ((GaussianBlur) filter).Size = size;
            lbSize.Text = size.ToString();
        }
    }
}
